package pattern;

import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
import com.alicp.jetcache.anno.config.EnableMethodCache;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import pattern.config.WebMvcConfig;
import pattern.config.listen.ApplicationInitialListener;

/**
 * rest-Api启动入口
 * @author Simon
 */

@SpringBootApplication(scanBasePackageClasses = {WebMvcConfig.class},
        exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, FlywayAutoConfiguration.class})
@EnableCreateCacheAnnotation
@EnableMethodCache(basePackages = "pattern.cache")
@Slf4j
@EnableFeignClients(basePackages = {"pattern.feign"})
@EnableDiscoveryClient
public class MessageBootApplication {
    public static void main(String[] args) {

        long start = System.currentTimeMillis();
        SpringApplication application = new SpringApplication(MessageBootApplication.class);
        //需要扫描菜单时加上
        application.addListeners(new ApplicationInitialListener());
        application.run(args);
        log.info("启动总耗时间{}ms", System.currentTimeMillis() - start);
    }
}
